package com.compiler.model;

import com.annotation.OnClick;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Name;

/**
 * Created by huilin on 2017/7/10.
 */

public class OnClickMethod {
    private ExecutableElement executableElement;
    private int[] rIds;

    public OnClickMethod(Element element) {
        if (element.getKind() != ElementKind.METHOD) {
            throw new IllegalArgumentException("only can method");
        }
        executableElement = (ExecutableElement) element;
        OnClick annotation = executableElement.getAnnotation(OnClick.class);
        rIds = annotation.value();
    }

    public Name getMethodName() {
        return executableElement.getSimpleName();
    }

    public int[] getRIds() {
        return rIds;
    }
}
